{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from apyori import apriori"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "导入数据及数据预处理"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [],
   "source": [
    "data=pd.read_csv('Transactions.csv',header=0)\n",
    "header=data.columns.values[1:]#获取列名\n",
    "data=np.array(data)[:,1:]\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "apyori"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[['tunny', 'mozzarella', 'tinnedmeat'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'coke', 'crackers'],\n",
       " ['water'],\n",
       " ['tunny'],\n",
       " ['pasta', 'milk', 'biscuits', 'crackers'],\n",
       " ['milk', 'biscuits', 'juices'],\n",
       " ['pasta'],\n",
       " ['oil'],\n",
       " ['biscuits'],\n",
       " ['tinnedmeat'],\n",
       " ['pasta', 'milk', 'coffee'],\n",
       " ['pasta', 'milk', 'tunny', 'tomatosouce', 'juices'],\n",
       " ['milk'],\n",
       " ['pasta', 'yoghurt'],\n",
       " ['milk', 'biscuits', ' brioches', 'crackers'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'coffee', 'juices'],\n",
       " [' brioches', 'juices'],\n",
       " ['biscuits'],\n",
       " ['pasta'],\n",
       " ['milk'],\n",
       " ['milk', 'water', 'coffee'],\n",
       " ['pasta'],\n",
       " ['beer', 'coke'],\n",
       " ['pasta', 'milk'],\n",
       " ['biscuits', 'mozzarella'],\n",
       " ['   frozenvegetables'],\n",
       " ['pasta', 'milk'],\n",
       " ['rice'],\n",
       " ['pasta', 'biscuits', 'crackers'],\n",
       " ['pasta', 'milk', '   frozenvegetables'],\n",
       " ['milk', 'coffee', 'yoghurt'],\n",
       " ['water', 'tomatosouce', 'rice'],\n",
       " ['milk'],\n",
       " ['biscuits'],\n",
       " ['milk', ' brioches', 'tunny'],\n",
       " ['pasta', 'milk', 'tomatosouce', 'crackers'],\n",
       " ['milk'],\n",
       " ['   frozenvegetables'],\n",
       " ['biscuits'],\n",
       " ['milk'],\n",
       " ['biscuits', 'oil'],\n",
       " ['beer'],\n",
       " ['pasta', 'yoghurt'],\n",
       " ['coffee'],\n",
       " ['biscuits', 'yoghurt', 'tomatosouce'],\n",
       " ['water', 'biscuits', 'coffee', 'rice'],\n",
       " ['pasta', 'water', 'rice'],\n",
       " [' brioches', 'mozzarella'],\n",
       " ['milk', 'water', 'tunny', 'tomatosouce'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'milk', 'water', ' brioches', 'tunny'],\n",
       " ['milk', 'biscuits'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['milk', '   frozenvegetables'],\n",
       " ['pasta', 'milk', 'rice'],\n",
       " ['yoghurt'],\n",
       " ['milk', 'biscuits', 'rice'],\n",
       " ['milk', 'water', 'coffee', 'tomatosouce', 'coke'],\n",
       " ['milk', 'water', 'coffee', 'yoghurt'],\n",
       " ['milk'],\n",
       " ['yoghurt', 'coke'],\n",
       " ['pasta', 'milk', 'water', ' brioches', 'yoghurt', 'juices', 'crackers'],\n",
       " ['crackers'],\n",
       " ['milk'],\n",
       " ['pasta',\n",
       "  'milk',\n",
       "  'water',\n",
       "  'biscuits',\n",
       "  ' brioches',\n",
       "  '   frozenvegetables',\n",
       "  'tunny'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'water'],\n",
       " ['milk', 'crackers'],\n",
       " ['beer', 'coke'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['water', 'coke'],\n",
       " ['milk', 'beer', 'mozzarella'],\n",
       " ['milk', 'water'],\n",
       " ['milk', 'oil'],\n",
       " ['milk'],\n",
       " ['beer'],\n",
       " ['milk', 'biscuits'],\n",
       " ['biscuits'],\n",
       " ['milk', 'coke'],\n",
       " ['milk', '   frozenvegetables'],\n",
       " ['coffee', '   frozenvegetables'],\n",
       " ['coke'],\n",
       " ['pasta'],\n",
       " ['pasta', 'tunny', 'tomatosouce', 'mozzarella'],\n",
       " ['beer'],\n",
       " ['pasta', 'frozenfish'],\n",
       " ['water'],\n",
       " ['pasta', 'milk', 'coffee', 'coke', 'juices'],\n",
       " ['biscuits', 'coke'],\n",
       " ['   frozenvegetables'],\n",
       " ['milk', '   frozenvegetables', 'beer'],\n",
       " ['milk', 'water'],\n",
       " ['milk', '   frozenvegetables'],\n",
       " ['pasta', 'milk', 'biscuits'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'water', 'beer', 'coke'],\n",
       " ['pasta', 'milk', 'coffee', 'yoghurt', 'tunny'],\n",
       " ['pasta', 'milk', 'yoghurt', 'tomatosouce'],\n",
       " ['pasta',\n",
       "  'milk',\n",
       "  'biscuits',\n",
       "  'coffee',\n",
       "  '   frozenvegetables',\n",
       "  'tunny',\n",
       "  'tomatosouce',\n",
       "  'frozenfish'],\n",
       " ['pasta', 'milk', 'tomatosouce', 'juices', 'crackers'],\n",
       " ['tunny'],\n",
       " ['beer'],\n",
       " ['milk'],\n",
       " ['biscuits', 'coffee'],\n",
       " ['biscuits'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['pasta', 'milk', '   frozenvegetables'],\n",
       " ['   frozenvegetables'],\n",
       " ['beer'],\n",
       " ['yoghurt'],\n",
       " ['biscuits'],\n",
       " ['milk', 'coffee', 'yoghurt', 'beer'],\n",
       " ['milk', 'water', 'coke'],\n",
       " ['biscuits'],\n",
       " ['milk', 'biscuits', 'coffee'],\n",
       " ['milk'],\n",
       " ['milk', 'water', 'coke'],\n",
       " ['milk', 'biscuits', '   frozenvegetables', 'icecream'],\n",
       " ['water', 'rice'],\n",
       " ['milk', 'biscuits'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'milk', '   frozenvegetables', 'beer'],\n",
       " ['pasta', 'milk', 'biscuits', 'coffee', 'yoghurt', 'coke'],\n",
       " ['yoghurt'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta'],\n",
       " ['milk', 'biscuits'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['water', 'coffee', 'tunny', 'oil'],\n",
       " ['milk', 'coffee'],\n",
       " ['pasta', 'milk', 'water', 'beer'],\n",
       " ['pasta'],\n",
       " ['yoghurt', 'juices', 'frozenfish'],\n",
       " ['tomatosouce', 'rice'],\n",
       " ['milk', 'beer'],\n",
       " ['water'],\n",
       " ['pasta', 'milk', 'water', 'biscuits', 'beer'],\n",
       " ['pasta', 'milk', 'water', 'coffee', 'tunny', 'tomatosouce'],\n",
       " ['milk', 'biscuits', 'beer'],\n",
       " ['pasta', 'milk', 'water', ' brioches', 'frozenfish'],\n",
       " ['milk', 'water', 'frozenfish'],\n",
       " ['milk', 'beer'],\n",
       " ['water', 'biscuits'],\n",
       " ['milk', 'beer'],\n",
       " ['water', 'yoghurt', 'tunny', 'frozenfish'],\n",
       " ['water'],\n",
       " ['water'],\n",
       " ['milk', 'frozenfish'],\n",
       " ['milk', ' brioches'],\n",
       " ['biscuits'],\n",
       " ['water'],\n",
       " ['pasta', 'coffee', 'yoghurt', 'beer'],\n",
       " ['pasta', 'milk', 'coke'],\n",
       " ['biscuits'],\n",
       " ['   frozenvegetables'],\n",
       " ['milk', 'beer'],\n",
       " ['biscuits', ' brioches'],\n",
       " ['frozenfish'],\n",
       " ['milk'],\n",
       " ['   frozenvegetables'],\n",
       " ['milk', 'biscuits', 'beer'],\n",
       " ['biscuits', 'rice'],\n",
       " ['milk', 'biscuits', ' brioches', '   frozenvegetables', 'tomatosouce'],\n",
       " ['milk', 'water', '   frozenvegetables'],\n",
       " ['pasta', 'milk', '   frozenvegetables', 'beer', 'juices'],\n",
       " ['water', 'coffee'],\n",
       " ['pasta', 'water', '   frozenvegetables'],\n",
       " ['biscuits', 'coke', 'crackers'],\n",
       " ['biscuits', 'coffee', 'crackers'],\n",
       " ['pasta', 'coffee'],\n",
       " ['pasta', 'biscuits', 'tomatosouce'],\n",
       " ['pasta', 'coke'],\n",
       " ['milk', 'biscuits', 'yoghurt', 'tomatosouce'],\n",
       " ['pasta', 'juices'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['pasta', 'beer', 'coke', 'frozenfish'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits'],\n",
       " ['yoghurt'],\n",
       " ['milk', 'yoghurt', 'coke'],\n",
       " ['milk', '   frozenvegetables', 'beer'],\n",
       " ['water', 'biscuits'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'water', 'tomatosouce', 'coke', 'oil'],\n",
       " ['pasta', 'milk', 'coffee', 'beer'],\n",
       " ['pasta', 'coke'],\n",
       " ['pasta', 'biscuits', 'yoghurt'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'milk', 'water', 'coffee'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'rice'],\n",
       " ['milk'],\n",
       " ['oil'],\n",
       " ['milk', 'juices', 'icecream'],\n",
       " ['pasta', 'milk', 'water', 'juices'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['milk', ' brioches'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['   frozenvegetables', 'mozzarella'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['pasta', 'biscuits', 'rice'],\n",
       " ['milk', 'water', 'coke', 'juices'],\n",
       " ['milk'],\n",
       " ['milk', 'water', 'biscuits', 'crackers'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['milk'],\n",
       " ['water'],\n",
       " ['water'],\n",
       " ['   frozenvegetables'],\n",
       " ['milk', 'coffee'],\n",
       " ['milk'],\n",
       " ['tomatosouce'],\n",
       " ['milk', 'beer'],\n",
       " ['pasta', 'milk', '   frozenvegetables'],\n",
       " ['pasta', 'water', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'yoghurt'],\n",
       " ['milk', 'biscuits', '   frozenvegetables'],\n",
       " ['pasta', 'water', 'biscuits', '   frozenvegetables'],\n",
       " ['pasta', 'tunny', 'rice'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'milk', 'coffee'],\n",
       " ['yoghurt', 'juices'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['milk', 'water', 'biscuits', ' brioches'],\n",
       " ['pasta', 'water', 'tomatosouce', 'coke'],\n",
       " ['pasta', '   frozenvegetables', 'tomatosouce'],\n",
       " ['pasta', ' brioches', 'yoghurt', '   frozenvegetables'],\n",
       " ['milk', 'coffee', 'frozenfish'],\n",
       " ['pasta', 'milk', 'water', ' brioches', 'coke', 'juices'],\n",
       " ['milk', 'biscuits', 'tunny'],\n",
       " ['coke'],\n",
       " ['pasta'],\n",
       " ['coffee'],\n",
       " ['water'],\n",
       " ['pasta', 'milk', 'water', 'tomatosouce', 'rice'],\n",
       " ['pasta'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['milk', 'yoghurt'],\n",
       " [' brioches'],\n",
       " ['milk', 'coffee', '   frozenvegetables', 'coke', 'juices'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['milk'],\n",
       " ['water'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['milk', 'beer', 'coke'],\n",
       " ['milk', ' brioches'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', '   frozenvegetables'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['milk', ' brioches'],\n",
       " ['pasta'],\n",
       " ['milk', 'biscuits', 'beer'],\n",
       " ['milk', 'coffee'],\n",
       " ['milk', 'coffee', 'beer', 'mozzarella'],\n",
       " ['   frozenvegetables', 'tomatosouce'],\n",
       " ['biscuits', '   frozenvegetables'],\n",
       " ['milk', 'water'],\n",
       " ['water'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'milk', 'water', 'biscuits', 'coke'],\n",
       " ['water', 'biscuits', 'tomatosouce', 'rice'],\n",
       " ['water', 'beer'],\n",
       " ['pasta', 'milk', ' brioches', 'yoghurt', 'tunny'],\n",
       " ['milk', ' brioches'],\n",
       " ['yoghurt'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['milk', 'water', 'beer'],\n",
       " ['milk', 'biscuits'],\n",
       " ['pasta'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'coffee', 'yoghurt', 'juices'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', 'water', 'biscuits', 'coffee'],\n",
       " ['milk', 'water', 'rice'],\n",
       " ['pasta'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'beer', 'coke'],\n",
       " ['pasta', 'water', 'tomatosouce', 'coke'],\n",
       " ['pasta', '   frozenvegetables'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', 'coffee', 'juices'],\n",
       " ['pasta'],\n",
       " ['juices'],\n",
       " ['biscuits', 'juices'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " [' brioches'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'milk', 'coffee', 'beer'],\n",
       " ['biscuits', 'yoghurt', 'tomatosouce'],\n",
       " ['biscuits'],\n",
       " ['pasta'],\n",
       " ['biscuits', '   frozenvegetables'],\n",
       " ['yoghurt', 'tunny'],\n",
       " ['milk', 'water'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'biscuits', 'yoghurt'],\n",
       " ['water'],\n",
       " ['water'],\n",
       " ['tomatosouce', 'rice'],\n",
       " ['pasta', 'rice'],\n",
       " ['pasta', 'water', 'coffee', 'coke', 'rice'],\n",
       " ['coffee'],\n",
       " ['coffee'],\n",
       " ['pasta', 'milk', 'water', 'biscuits', 'coffee', 'beer'],\n",
       " ['water', 'biscuits', 'coke'],\n",
       " ['milk', 'frozenfish'],\n",
       " ['milk', 'water', 'biscuits', 'coffee'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits', 'yoghurt', '   frozenvegetables', 'frozenfish'],\n",
       " ['coffee', 'beer', 'coke'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['milk', 'coffee'],\n",
       " ['pasta', 'water', 'yoghurt'],\n",
       " ['pasta', 'milk', 'water', 'yoghurt', '   frozenvegetables', 'tunny'],\n",
       " ['pasta'],\n",
       " ['rice', 'juices'],\n",
       " ['   frozenvegetables', 'beer'],\n",
       " ['milk', 'biscuits'],\n",
       " ['milk', 'tunny'],\n",
       " ['milk', 'water'],\n",
       " ['water'],\n",
       " ['water'],\n",
       " ['pasta', 'water', 'yoghurt', 'beer'],\n",
       " [' brioches', 'yoghurt'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['water'],\n",
       " ['water'],\n",
       " ['milk', 'water', 'beer'],\n",
       " ['pasta', 'milk', 'coffee', 'beer'],\n",
       " ['milk'],\n",
       " ['milk', 'water', 'biscuits', 'yoghurt'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'coffee', 'tunny', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'water', 'biscuits', 'tomatosouce', 'juices'],\n",
       " ['milk', 'biscuits', 'tomatosouce', 'juices'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'milk', 'water', 'beer', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk'],\n",
       " ['biscuits', 'coke'],\n",
       " ['pasta', 'milk', 'biscuits', 'tunny'],\n",
       " ['water', 'yoghurt'],\n",
       " ['pasta', 'milk', 'water', 'biscuits'],\n",
       " ['pasta', 'biscuits', '   frozenvegetables', 'beer', 'frozenfish'],\n",
       " ['milk', '   frozenvegetables'],\n",
       " ['pasta'],\n",
       " ['milk'],\n",
       " ['rice', 'juices', 'oil'],\n",
       " ['milk', 'rice'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'rice'],\n",
       " ['pasta', 'water', 'tunny', 'coke'],\n",
       " ['milk', 'biscuits'],\n",
       " ['   frozenvegetables'],\n",
       " ['pasta', 'milk', ' brioches', 'tomatosouce'],\n",
       " ['milk', 'coffee'],\n",
       " ['biscuits', 'coffee', '   frozenvegetables', 'beer'],\n",
       " ['pasta', 'milk', 'tomatosouce', 'rice'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['   frozenvegetables'],\n",
       " ['water'],\n",
       " ['pasta', 'milk', 'yoghurt'],\n",
       " ['pasta', 'milk', 'tomatosouce'],\n",
       " ['pasta', 'water', 'coke'],\n",
       " ['milk', ' brioches', 'crackers'],\n",
       " ['milk'],\n",
       " ['milk', 'coke'],\n",
       " ['   frozenvegetables'],\n",
       " ['   frozenvegetables'],\n",
       " ['water', '   frozenvegetables', 'frozenfish'],\n",
       " ['milk', 'biscuits', ' brioches', 'tunny'],\n",
       " ['pasta'],\n",
       " ['milk'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'water', 'coffee', ' brioches', 'juices'],\n",
       " ['water'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'water', 'rice'],\n",
       " ['pasta', 'milk', 'coffee'],\n",
       " ['oil'],\n",
       " ['milk', 'biscuits', '   frozenvegetables'],\n",
       " [' brioches', 'yoghurt', '   frozenvegetables', 'juices'],\n",
       " ['milk', 'biscuits'],\n",
       " ['pasta', 'milk', '   frozenvegetables'],\n",
       " ['milk',\n",
       "  'water',\n",
       "  'coffee',\n",
       "  'yoghurt',\n",
       "  '   frozenvegetables',\n",
       "  'tunny',\n",
       "  'juices',\n",
       "  'frozenfish'],\n",
       " ['biscuits', '   frozenvegetables'],\n",
       " ['pasta', 'tunny'],\n",
       " ['pasta', ' brioches', 'tunny', 'crackers'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['milk', '   frozenvegetables', 'frozenfish'],\n",
       " ['milk'],\n",
       " ['yoghurt'],\n",
       " ['milk', 'water', 'tunny', 'rice'],\n",
       " ['milk'],\n",
       " ['milk', 'water'],\n",
       " ['milk', 'biscuits'],\n",
       " ['tomatosouce', 'coke'],\n",
       " ['milk'],\n",
       " ['biscuits', 'icecream'],\n",
       " ['milk', 'water', 'tomatosouce'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', '   frozenvegetables'],\n",
       " ['milk'],\n",
       " ['coffee', '   frozenvegetables'],\n",
       " ['yoghurt'],\n",
       " ['milk', 'water', '   frozenvegetables', 'juices'],\n",
       " ['coffee', ' brioches'],\n",
       " ['pasta', 'milk', 'coffee', 'coke'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'water', 'juices'],\n",
       " [' brioches'],\n",
       " ['milk', '   frozenvegetables', 'tunny', 'juices', 'frozenfish'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'beer', 'coke'],\n",
       " ['pasta', 'milk', 'biscuits', 'coffee'],\n",
       " ['milk', 'yoghurt', 'tomatosouce'],\n",
       " ['milk', 'coffee', ' brioches'],\n",
       " ['water'],\n",
       " ['milk'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'milk', 'tunny', 'tomatosouce'],\n",
       " ['milk', 'coffee'],\n",
       " ['water', 'mozzarella'],\n",
       " ['biscuits', ' brioches'],\n",
       " ['milk', '   frozenvegetables'],\n",
       " ['pasta', '   frozenvegetables'],\n",
       " ['pasta', 'milk', 'coffee'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'biscuits', 'coffee'],\n",
       " ['pasta', 'tomatosouce'],\n",
       " ['juices'],\n",
       " ['coffee'],\n",
       " ['milk', 'biscuits', ' brioches', 'tunny'],\n",
       " ['biscuits'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'coffee', 'coke'],\n",
       " ['pasta', 'biscuits', 'coffee', 'beer', 'rice'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk'],\n",
       " [' brioches'],\n",
       " ['milk', 'water', '   frozenvegetables', 'coke'],\n",
       " ['pasta', 'water'],\n",
       " ['pasta', 'milk', 'tunny', 'tomatosouce', 'rice'],\n",
       " ['pasta', '   frozenvegetables'],\n",
       " ['water', 'beer'],\n",
       " ['biscuits'],\n",
       " ['water', ' brioches', 'tomatosouce'],\n",
       " ['coffee'],\n",
       " ['pasta', 'water', 'biscuits', 'coke'],\n",
       " ['pasta', 'milk', 'biscuits', 'coffee', 'yoghurt', 'mozzarella'],\n",
       " ['coffee', 'tunny'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['coke'],\n",
       " ['milk', 'biscuits', 'rice'],\n",
       " ['pasta', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta',\n",
       "  'milk',\n",
       "  'coffee',\n",
       "  ' brioches',\n",
       "  '   frozenvegetables',\n",
       "  'tunny',\n",
       "  'coke',\n",
       "  'crackers'],\n",
       " ['milk', 'water'],\n",
       " ['milk', 'biscuits', 'coffee', 'yoghurt', 'coke', 'juices'],\n",
       " ['pasta', 'biscuits', 'yoghurt', 'coke'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', 'tunny'],\n",
       " ['pasta', 'rice'],\n",
       " ['milk', 'yoghurt', 'tunny'],\n",
       " ['biscuits', 'coffee', 'tomatosouce'],\n",
       " ['pasta', 'water', 'coke', 'rice'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits'],\n",
       " [' brioches'],\n",
       " ['pasta', 'milk', 'coffee'],\n",
       " ['pasta', 'water', 'biscuits', 'coffee', 'tomatosouce', 'coke', 'mozzarella'],\n",
       " ['   frozenvegetables', 'tomatosouce'],\n",
       " ['water', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['pasta', ' brioches', 'rice'],\n",
       " ['milk', 'water', 'biscuits', ' brioches', 'crackers'],\n",
       " ['water'],\n",
       " ['   frozenvegetables', 'beer', 'oil'],\n",
       " ['milk', 'tomatosouce', 'rice'],\n",
       " ['pasta', 'milk', 'coffee', 'tomatosouce', 'juices'],\n",
       " ['pasta', 'milk', 'yoghurt', '   frozenvegetables'],\n",
       " ['biscuits', 'beer', 'coke', 'oil'],\n",
       " ['pasta', 'milk', 'water', 'coffee'],\n",
       " ['pasta', 'milk', 'water', 'coffee'],\n",
       " ['biscuits', 'coke'],\n",
       " ['yoghurt'],\n",
       " ['pasta', 'water', 'coke'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'coke', 'rice'],\n",
       " ['pasta', 'milk', 'water', 'coffee', 'coke'],\n",
       " ['milk', ' brioches', 'tunny'],\n",
       " ['milk'],\n",
       " ['pasta', 'water'],\n",
       " ['mozzarella'],\n",
       " ['coffee'],\n",
       " ['water'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'milk', 'water', 'coke', 'rice', 'mozzarella'],\n",
       " ['pasta', '   frozenvegetables', 'oil', 'frozenfish'],\n",
       " ['tomatosouce'],\n",
       " ['tunny'],\n",
       " ['water', 'juices'],\n",
       " ['   frozenvegetables', 'coke'],\n",
       " ['   frozenvegetables'],\n",
       " ['pasta', 'milk', 'rice'],\n",
       " ['milk', 'coffee', '   frozenvegetables'],\n",
       " ['water', 'coke'],\n",
       " ['milk', 'biscuits', 'coffee', ' brioches', 'coke'],\n",
       " ['pasta', 'milk', 'juices'],\n",
       " ['pasta', 'milk', 'water', 'rice'],\n",
       " ['pasta'],\n",
       " ['pasta', 'coffee', 'tunny'],\n",
       " ['milk', 'beer', 'juices'],\n",
       " ['pasta'],\n",
       " ['milk', 'tomatosouce'],\n",
       " [' brioches'],\n",
       " ['pasta', 'water'],\n",
       " ['pasta', '   frozenvegetables', 'tunny'],\n",
       " ['milk', 'water'],\n",
       " ['milk', 'biscuits'],\n",
       " ['yoghurt'],\n",
       " ['   frozenvegetables'],\n",
       " ['pasta', 'water', 'beer', 'coke'],\n",
       " ['pasta', 'milk', 'water', 'coffee'],\n",
       " ['pasta', 'milk', 'oil'],\n",
       " ['milk', 'biscuits', 'coffee'],\n",
       " ['water'],\n",
       " ['milk'],\n",
       " ['milk', 'water', 'beer', 'coke', 'oil'],\n",
       " ['juices'],\n",
       " ['pasta', 'milk', 'water', 'coffee', 'beer'],\n",
       " ['pasta', 'biscuits', 'rice', 'juices'],\n",
       " ['pasta'],\n",
       " ['milk', 'biscuits'],\n",
       " ['water'],\n",
       " ['milk', 'water', 'tomatosouce'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['pasta', 'biscuits', ' brioches', 'coke'],\n",
       " ['pasta', 'water'],\n",
       " ['milk'],\n",
       " ['milk', 'coke'],\n",
       " ['biscuits', ' brioches', '   frozenvegetables'],\n",
       " ['pasta', 'milk', 'water', ' brioches', 'tomatosouce'],\n",
       " ['pasta', 'milk', ' brioches'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta'],\n",
       " ['pasta',\n",
       "  'milk',\n",
       "  'coffee',\n",
       "  ' brioches',\n",
       "  'yoghurt',\n",
       "  'tunny',\n",
       "  'tomatosouce',\n",
       "  'coke'],\n",
       " ['pasta', 'tomatosouce'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'water', 'tunny', 'oil'],\n",
       " ['pasta', 'coffee'],\n",
       " ['pasta', 'yoghurt', 'coke'],\n",
       " ['pasta', 'milk', 'coffee', 'tomatosouce'],\n",
       " ['pasta', 'water', 'coffee', '   frozenvegetables'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['milk'],\n",
       " ['pasta', 'water', 'oil'],\n",
       " ['coffee'],\n",
       " ['pasta', 'water', 'coffee', '   frozenvegetables', 'tunny'],\n",
       " ['milk', 'water', 'coffee', 'tunny'],\n",
       " ['milk', 'biscuits'],\n",
       " ['pasta', 'tomatosouce', 'coke', 'rice'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'milk', 'coffee', 'rice'],\n",
       " ['pasta', 'coffee', 'tomatosouce'],\n",
       " ['pasta'],\n",
       " ['pasta', 'biscuits', 'beer', 'rice'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'milk', 'coffee', 'yoghurt'],\n",
       " ['pasta', 'milk', ' brioches', 'rice'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['pasta', ' brioches', '   frozenvegetables', 'mozzarella'],\n",
       " ['pasta', 'biscuits', ' brioches', 'tomatosouce', 'coke'],\n",
       " ['pasta', 'milk'],\n",
       " ['coffee'],\n",
       " ['biscuits', ' brioches'],\n",
       " ['water', 'coffee'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['milk', 'juices'],\n",
       " ['milk'],\n",
       " ['pasta', 'rice'],\n",
       " ['milk', 'water'],\n",
       " ['milk'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['milk', 'beer'],\n",
       " ['coffee', 'coke', 'juices'],\n",
       " ['rice'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'beer'],\n",
       " ['milk', 'biscuits', 'juices'],\n",
       " ['coffee'],\n",
       " ['pasta'],\n",
       " ['milk', 'biscuits', 'coffee'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'water', 'crackers'],\n",
       " ['milk', 'water', 'rice'],\n",
       " ['pasta', 'milk', 'coffee'],\n",
       " ['pasta',\n",
       "  'milk',\n",
       "  'water',\n",
       "  'biscuits',\n",
       "  ' brioches',\n",
       "  '   frozenvegetables',\n",
       "  'tomatosouce',\n",
       "  'juices'],\n",
       " ['pasta'],\n",
       " ['pasta'],\n",
       " ['milk', 'tomatosouce', 'coke', 'oil'],\n",
       " ['pasta', 'milk', 'water', 'biscuits'],\n",
       " ['milk', '   frozenvegetables', 'rice'],\n",
       " ['pasta', 'yoghurt'],\n",
       " [' brioches'],\n",
       " ['tunny', 'tinnedmeat'],\n",
       " ['pasta', 'milk', 'juices'],\n",
       " ['milk', 'water', ' brioches', 'yoghurt'],\n",
       " ['coffee'],\n",
       " ['tomatosouce'],\n",
       " ['pasta', ' brioches', 'beer'],\n",
       " ['pasta'],\n",
       " ['pasta'],\n",
       " ['water'],\n",
       " ['milk', 'juices'],\n",
       " ['pasta', 'milk', 'water', 'yoghurt'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'milk', 'biscuits', 'coke', 'rice'],\n",
       " ['pasta', ' brioches', '   frozenvegetables'],\n",
       " ['biscuits', 'rice'],\n",
       " ['pasta', 'milk', ' brioches', '   frozenvegetables', 'tunny', 'coke'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits'],\n",
       " ['water'],\n",
       " ['biscuits'],\n",
       " ['biscuits', 'coke'],\n",
       " ['pasta'],\n",
       " ['milk', '   frozenvegetables'],\n",
       " ['pasta',\n",
       "  'biscuits',\n",
       "  'coffee',\n",
       "  ' brioches',\n",
       "  'tomatosouce',\n",
       "  'coke',\n",
       "  'rice',\n",
       "  'juices'],\n",
       " ['tomatosouce', 'coke'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'milk', 'water', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['pasta', 'tomatosouce'],\n",
       " ['water'],\n",
       " ['milk', 'biscuits'],\n",
       " ['pasta', 'rice'],\n",
       " ['pasta', 'milk'],\n",
       " ['tomatosouce'],\n",
       " ['pasta', 'milk', 'beer'],\n",
       " ['biscuits', 'juices'],\n",
       " ['water', 'yoghurt'],\n",
       " ['pasta', 'milk', ' brioches', '   frozenvegetables', 'beer', 'coke', 'rice'],\n",
       " ['biscuits', 'yoghurt'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'milk', 'water', '   frozenvegetables'],\n",
       " ['milk', 'yoghurt', 'beer', 'tomatosouce', 'coke'],\n",
       " ['coffee'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " [' brioches', 'yoghurt'],\n",
       " ['coffee'],\n",
       " ['milk'],\n",
       " ['mozzarella'],\n",
       " ['pasta', 'milk'],\n",
       " ['yoghurt', 'tunny', 'rice'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'water', ' brioches', 'yoghurt', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'coffee', 'oil'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'tunny', 'tomatosouce', 'rice'],\n",
       " ['pasta', 'milk', 'water', '   frozenvegetables'],\n",
       " ['pasta', 'water', 'yoghurt'],\n",
       " ['milk', 'biscuits', 'coffee', 'beer'],\n",
       " ['water', 'yoghurt', 'beer', 'tomatosouce', 'coke', 'oil'],\n",
       " ['beer'],\n",
       " [' brioches', '   frozenvegetables', 'coke'],\n",
       " ['pasta', 'milk', 'biscuits', '   frozenvegetables'],\n",
       " ['pasta', 'coffee'],\n",
       " [' brioches', 'mozzarella'],\n",
       " ['tomatosouce'],\n",
       " ['water'],\n",
       " ['pasta', 'milk', 'water', 'oil'],\n",
       " ['milk', 'tunny', 'beer', 'coke'],\n",
       " ['water'],\n",
       " ['milk', '   frozenvegetables', 'tomatosouce', 'rice'],\n",
       " ['water'],\n",
       " ['milk', 'water'],\n",
       " ['milk'],\n",
       " ['tomatosouce'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'tunny', 'tinnedmeat'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits', ' brioches'],\n",
       " ['   frozenvegetables', 'coke'],\n",
       " ['   frozenvegetables'],\n",
       " ['pasta', 'tunny', 'rice'],\n",
       " ['milk', 'rice'],\n",
       " ['milk', 'coffee'],\n",
       " ['water', 'coffee'],\n",
       " ['water', 'coffee', ' brioches', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'water', 'coffee', 'coke'],\n",
       " ['tunny', 'rice'],\n",
       " ['milk', 'crackers'],\n",
       " ['pasta', 'milk', 'water', 'biscuits'],\n",
       " ['milk'],\n",
       " ['pasta', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'biscuits', '   frozenvegetables', 'coke', 'rice'],\n",
       " ['pasta', 'milk', 'coffee', 'beer'],\n",
       " ['   frozenvegetables', 'rice'],\n",
       " ['water'],\n",
       " ['milk', 'mozzarella'],\n",
       " ['water', '   frozenvegetables', 'tomatosouce'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits', '   frozenvegetables', 'coke'],\n",
       " ['milk'],\n",
       " ['pasta', 'coffee', 'coke'],\n",
       " ['pasta', 'milk', 'juices'],\n",
       " ['milk', '   frozenvegetables'],\n",
       " ['pasta', 'milk', 'water', 'coffee', 'tomatosouce', 'mozzarella'],\n",
       " ['pasta', 'water', 'coffee', 'coke', 'juices'],\n",
       " ['pasta', 'milk', 'water', 'coffee', 'juices', 'crackers'],\n",
       " ['pasta', 'milk', 'tomatosouce'],\n",
       " ['pasta'],\n",
       " ['pasta'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'water', 'beer'],\n",
       " ['pasta'],\n",
       " ['biscuits', 'yoghurt'],\n",
       " ['pasta', 'water', 'oil'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['pasta'],\n",
       " ['coffee', '   frozenvegetables'],\n",
       " ['pasta', 'milk'],\n",
       " ['beer', 'coke'],\n",
       " ['milk', 'water', 'coffee', ' brioches', '   frozenvegetables'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk'],\n",
       " ['water'],\n",
       " ['milk'],\n",
       " ['tomatosouce', 'frozenfish'],\n",
       " ['pasta', 'rice'],\n",
       " ['oil'],\n",
       " ['frozenfish'],\n",
       " ['pasta'],\n",
       " ['pasta', 'milk', 'water', 'biscuits', ' brioches', 'yoghurt', 'tomatosouce'],\n",
       " ['milk', 'yoghurt', 'coke'],\n",
       " ['rice'],\n",
       " ['pasta', 'milk', 'water', 'juices', 'crackers'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', 'tunny'],\n",
       " ['milk', 'crackers'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['pasta', 'biscuits', '   frozenvegetables', 'rice'],\n",
       " [' brioches', 'mozzarella'],\n",
       " ['pasta', 'milk', 'water', ' brioches', '   frozenvegetables', 'tomatosouce'],\n",
       " ['milk', 'water', 'juices'],\n",
       " ['milk', 'water', 'beer', 'tomatosouce'],\n",
       " ['pasta', '   frozenvegetables', 'tunny'],\n",
       " ['pasta', 'milk', ' brioches'],\n",
       " ['milk', 'water', ' brioches'],\n",
       " ['water'],\n",
       " ['pasta', 'milk', 'rice'],\n",
       " ['coffee', '   frozenvegetables'],\n",
       " ['pasta', 'water', 'biscuits'],\n",
       " ['pasta', 'milk', 'yoghurt', '   frozenvegetables'],\n",
       " ['milk', 'coffee', 'tunny'],\n",
       " [' brioches'],\n",
       " ['   frozenvegetables'],\n",
       " ['water', 'rice'],\n",
       " ['milk', 'biscuits', 'coffee', 'yoghurt', 'tomatosouce'],\n",
       " ['pasta', 'water', 'tomatosouce', 'oil'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['pasta', 'coffee', '   frozenvegetables', 'tomatosouce'],\n",
       " ['pasta', 'beer'],\n",
       " ['pasta', 'milk', ' brioches', 'rice'],\n",
       " ['yoghurt', 'rice'],\n",
       " ['milk'],\n",
       " ['coffee'],\n",
       " ['milk'],\n",
       " ['milk', 'coffee', ' brioches', 'coke'],\n",
       " ['coffee', 'tomatosouce', 'coke'],\n",
       " ['coffee', 'crackers'],\n",
       " ['pasta', '   frozenvegetables'],\n",
       " ['milk', 'water', 'biscuits', ' brioches'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk', 'water', 'biscuits'],\n",
       " ['pasta', 'milk', 'biscuits'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', '   frozenvegetables', 'oil'],\n",
       " ['milk', '   frozenvegetables', 'tunny'],\n",
       " ['biscuits'],\n",
       " ['milk', 'water', 'coke'],\n",
       " ['biscuits'],\n",
       " ['pasta', 'milk', 'biscuits', '   frozenvegetables', 'frozenfish'],\n",
       " ['pasta', 'biscuits', 'yoghurt'],\n",
       " ['pasta'],\n",
       " ['pasta', 'water', 'biscuits', 'yoghurt', 'juices'],\n",
       " ['pasta'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['coke'],\n",
       " ['water', 'tomatosouce'],\n",
       " ['tomatosouce', 'crackers'],\n",
       " ['coffee'],\n",
       " ['pasta', 'milk', ' brioches', 'yoghurt', 'beer', 'coke', 'oil'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['milk', '   frozenvegetables', 'juices'],\n",
       " ['milk'],\n",
       " ['milk'],\n",
       " ['pasta'],\n",
       " ['coke'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits', 'crackers'],\n",
       " ['pasta', 'milk', ' brioches'],\n",
       " ['water', 'biscuits', 'coffee', 'yoghurt', 'coke', 'rice'],\n",
       " ['milk', 'water'],\n",
       " ['milk', 'crackers', 'icecream'],\n",
       " ['milk', 'water', 'biscuits', ' brioches', 'rice', 'juices'],\n",
       " ['pasta', 'milk', 'water'],\n",
       " ['water', 'biscuits'],\n",
       " ['milk', 'biscuits'],\n",
       " ['beer', 'rice'],\n",
       " ['milk'],\n",
       " ['milk', 'water', 'tunny'],\n",
       " ['pasta', 'milk'],\n",
       " ['biscuits', ' brioches', 'tunny', 'coke', 'crackers', 'tinnedmeat'],\n",
       " ['pasta', 'milk', 'coffee', 'yoghurt', 'mozzarella'],\n",
       " ['oil'],\n",
       " ['milk', 'biscuits'],\n",
       " ['pasta', 'milk', 'tomatosouce', 'juices'],\n",
       " ['pasta', 'milk', 'water', 'biscuits', 'tomatosouce', 'crackers'],\n",
       " ['pasta', 'water', 'coke'],\n",
       " ['biscuits', '   frozenvegetables'],\n",
       " ['coffee', 'rice'],\n",
       " ['pasta', 'biscuits', '   frozenvegetables'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['biscuits'],\n",
       " ['water', '   frozenvegetables', 'beer', 'tinnedmeat'],\n",
       " ['pasta', 'milk', '   frozenvegetables'],\n",
       " ['water', 'yoghurt'],\n",
       " ['pasta', 'milk', 'water', 'yoghurt', 'oil'],\n",
       " ['water'],\n",
       " ['milk', 'coffee'],\n",
       " ['water'],\n",
       " ['pasta', 'water'],\n",
       " ['coffee', ' brioches'],\n",
       " ['biscuits', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'water', 'coffee', 'tunny'],\n",
       " ['milk'],\n",
       " ['crackers'],\n",
       " ['pasta', 'milk', 'tunny'],\n",
       " ['water'],\n",
       " ['pasta', 'water'],\n",
       " ['coffee'],\n",
       " ['pasta'],\n",
       " ['water'],\n",
       " ['pasta', 'milk'],\n",
       " ['tunny', 'coke'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['water', 'juices'],\n",
       " ['pasta', ' brioches'],\n",
       " ['crackers'],\n",
       " ['milk', 'yoghurt'],\n",
       " ['yoghurt'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'milk'],\n",
       " ['milk', 'water'],\n",
       " ['pasta', 'biscuits'],\n",
       " ['pasta', 'biscuits', 'tunny', 'rice'],\n",
       " ['pasta'],\n",
       " ['tunny'],\n",
       " ['milk'],\n",
       " ['pasta', ' brioches', 'yoghurt'],\n",
       " ['pasta', 'water'],\n",
       " ['mozzarella'],\n",
       " ['coke'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['yoghurt', 'juices', 'mozzarella'],\n",
       " ['pasta', 'milk', 'yoghurt'],\n",
       " ['   frozenvegetables'],\n",
       " ['milk', 'coke'],\n",
       " ['milk', 'tunny', 'rice', 'juices'],\n",
       " ['milk', 'biscuits', 'coffee', 'yoghurt'],\n",
       " ['pasta', 'milk', 'biscuits', 'yoghurt', 'coke'],\n",
       " ['milk', 'water', 'tunny', 'crackers', 'oil'],\n",
       " [' brioches', 'yoghurt', 'juices'],\n",
       " ['milk', 'biscuits', 'coffee'],\n",
       " ['juices'],\n",
       " ['milk', 'water', 'biscuits'],\n",
       " ['yoghurt', '   frozenvegetables'],\n",
       " ['milk', 'rice'],\n",
       " ['rice'],\n",
       " ['milk', 'water', 'coffee'],\n",
       " ['milk', 'coffee'],\n",
       " ['milk', 'biscuits'],\n",
       " ['pasta', 'milk', 'water', 'coffee'],\n",
       " ['milk', 'tomatosouce'],\n",
       " ['milk', 'water', 'coffee'],\n",
       " ['yoghurt'],\n",
       " [' brioches'],\n",
       " ['milk', 'crackers'],\n",
       " ['rice'],\n",
       " ['milk'],\n",
       " ['water'],\n",
       " ['milk', 'coffee'],\n",
       " ['pasta'],\n",
       " ['water', 'coffee'],\n",
       " ['milk'],\n",
       " ['pasta', 'milk'],\n",
       " ['coffee'],\n",
       " ['pasta', 'milk', 'water', 'coffee', '   frozenvegetables'],\n",
       " ['beer', 'juices'],\n",
       " ['milk', 'biscuits', 'coffee'],\n",
       " ['tunny'],\n",
       " ['water'],\n",
       " ['pasta', 'milk', 'biscuits'],\n",
       " ['pasta', 'milk', 'biscuits'],\n",
       " ['pasta', 'biscuits', 'frozenfish'],\n",
       " ['rice'],\n",
       " ['milk', 'water', 'tunny', 'mozzarella'],\n",
       " ['pasta', 'milk'],\n",
       " ['pasta', 'milk', 'water', 'frozenfish'],\n",
       " ['   frozenvegetables'],\n",
       " ['pasta', 'milk', 'tomatosouce'],\n",
       " ['pasta', 'milk', 'water', ' brioches', 'yoghurt', 'beer', 'juices'],\n",
       " ['tomatosouce'],\n",
       " ['milk', 'coffee', 'tunny'],\n",
       " ['pasta', 'coffee', 'yoghurt'],\n",
       " ['pasta',\n",
       "  'milk',\n",
       "  'biscuits',\n",
       "  'coffee',\n",
       "  'yoghurt',\n",
       "  '   frozenvegetables',\n",
       "  'tomatosouce'],\n",
       " ['   frozenvegetables'],\n",
       " ['milk', 'water'],\n",
       " ['milk', 'coffee'],\n",
       " ['water'],\n",
       " ['milk', 'coffee', 'yoghurt', 'frozenfish'],\n",
       " ['milk'],\n",
       " ['pasta', 'biscuits', 'tunny', 'rice', 'oil'],\n",
       " ['biscuits'],\n",
       " ['milk', 'water', '   frozenvegetables'],\n",
       " ['mozzarella'],\n",
       " ['pasta', 'milk', 'biscuits', 'oil'],\n",
       " ['pasta', 'milk', 'water', 'juices', 'oil'],\n",
       " ['mozzarella'],\n",
       " ['milk', 'yoghurt', 'beer'],\n",
       " ['water', 'coffee', 'yoghurt'],\n",
       " ['tomatosouce'],\n",
       " ['milk'],\n",
       " ['pasta', 'water'],\n",
       " ['pasta', '   frozenvegetables'],\n",
       " ['milk', 'tunny'],\n",
       " ['coffee', 'coke'],\n",
       " ['pasta', 'yoghurt'],\n",
       " ['pasta', 'yoghurt'],\n",
       " ['biscuits'],\n",
       " [' brioches'],\n",
       " ['milk'],\n",
       " ['milk', 'biscuits'],\n",
       " ['pasta', 'yoghurt', 'oil'],\n",
       " ...]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "X=[[header[i] for i in range(item.shape[0]) if item[i]==1] for item in data]\n",
    "X"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[RelationRecord(items=frozenset({'   frozenvegetables'}), support=0.11389831974569124, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'   frozenvegetables'}), confidence=0.11389831974569124, lift=1.0)]), RelationRecord(items=frozenset({' brioches'}), support=0.15319075319507816, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({' brioches'}), confidence=0.15319075319507816, lift=1.0)]), RelationRecord(items=frozenset({'beer'}), support=0.1092057176221266, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'beer'}), confidence=0.1092057176221266, lift=1.0)]), RelationRecord(items=frozenset({'biscuits'}), support=0.20474450187055337, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'biscuits'}), confidence=0.20474450187055337, lift=1.0)]), RelationRecord(items=frozenset({'coffee'}), support=0.15027139242696191, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'coffee'}), confidence=0.15027139242696191, lift=1.0)]), RelationRecord(items=frozenset({'coke'}), support=0.10706485305884134, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'coke'}), confidence=0.10706485305884134, lift=1.0)]), RelationRecord(items=frozenset({'milk'}), support=0.46132387604610425, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'milk'}), confidence=0.46132387604610425, lift=1.0)]), RelationRecord(items=frozenset({'pasta'}), support=0.35034491706852927, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'pasta'}), confidence=0.35034491706852927, lift=1.0)]), RelationRecord(items=frozenset({'tomatosouce'}), support=0.11597430962524058, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'tomatosouce'}), confidence=0.11597430962524058, lift=1.0)]), RelationRecord(items=frozenset({'tunny'}), support=0.10386436866120277, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'tunny'}), confidence=0.10386436866120277, lift=1.0)]), RelationRecord(items=frozenset({'water'}), support=0.27850701727829075, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'water'}), confidence=0.27850701727829075, lift=1.0)]), RelationRecord(items=frozenset({'yoghurt'}), support=0.15234738230651126, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'yoghurt'}), confidence=0.15234738230651126, lift=1.0)]), RelationRecord(items=frozenset({'biscuits', 'milk'}), support=0.10550786064917933, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'biscuits', 'milk'}), confidence=0.10550786064917933, lift=1.0), OrderedStatistic(items_base=frozenset({'biscuits'}), items_add=frozenset({'milk'}), confidence=0.5153147444021968, lift=1.1170346282937602), OrderedStatistic(items_base=frozenset({'milk'}), items_add=frozenset({'biscuits'}), confidence=0.22870669854216472, lift=1.1170346282937604)]), RelationRecord(items=frozenset({'pasta', 'milk'}), support=0.1606513418247086, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'pasta', 'milk'}), confidence=0.1606513418247086, lift=1.0), OrderedStatistic(items_base=frozenset({'milk'}), items_add=frozenset({'pasta'}), confidence=0.3482398162471289, lift=0.9939913476153314), OrderedStatistic(items_base=frozenset({'pasta'}), items_add=frozenset({'milk'}), confidence=0.4585519412381952, lift=0.9939913476153313)]), RelationRecord(items=frozenset({'water', 'milk'}), support=0.13007374089051316, ordered_statistics=[OrderedStatistic(items_base=frozenset(), items_add=frozenset({'water', 'milk'}), confidence=0.13007374089051316, lift=1.0), OrderedStatistic(items_base=frozenset({'milk'}), items_add=frozenset({'water'}), confidence=0.28195753058641543, lift=1.0123893226886878), OrderedStatistic(items_base=frozenset({'water'}), items_add=frozenset({'milk'}), confidence=0.46703936641043564, lift=1.0123893226886878)])]\n"
     ]
    }
   ],
   "source": [
    "result = list(apriori(transactions=X, min_support=0.1, min_confidence=0.1))\n",
    "print(result)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "FPGrowth"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[[8, 18, 19],\n",
       " [1],\n",
       " [0, 1, 11, 14],\n",
       " [2],\n",
       " [8],\n",
       " [0, 1, 3, 14],\n",
       " [1, 3, 13],\n",
       " [0],\n",
       " [15],\n",
       " [3],\n",
       " [19],\n",
       " [0, 1, 4],\n",
       " [0, 1, 8, 10, 13],\n",
       " [1],\n",
       " [0, 6],\n",
       " [1, 3, 5, 14],\n",
       " [0],\n",
       " [0, 1],\n",
       " [0, 4, 13],\n",
       " [5, 13],\n",
       " [3],\n",
       " [0],\n",
       " [1],\n",
       " [1, 2, 4],\n",
       " [0],\n",
       " [9, 11],\n",
       " [0, 1],\n",
       " [3, 18],\n",
       " [7],\n",
       " [0, 1],\n",
       " [12],\n",
       " [0, 3, 14],\n",
       " [0, 1, 7],\n",
       " [1, 4, 6],\n",
       " [2, 10, 12],\n",
       " [1],\n",
       " [3],\n",
       " [1, 5, 8],\n",
       " [0, 1, 10, 14],\n",
       " [1],\n",
       " [7],\n",
       " [3],\n",
       " [1],\n",
       " [3, 15],\n",
       " [9],\n",
       " [0, 6],\n",
       " [4],\n",
       " [3, 6, 10],\n",
       " [2, 3, 4, 12],\n",
       " [0, 2, 12],\n",
       " [5, 18],\n",
       " [1, 2, 8, 10],\n",
       " [1, 2],\n",
       " [0, 1, 2, 5, 8],\n",
       " [1, 3],\n",
       " [1],\n",
       " [0],\n",
       " [1, 7],\n",
       " [0, 1, 12],\n",
       " [6],\n",
       " [1, 3, 12],\n",
       " [1, 2, 4, 10, 11],\n",
       " [1, 2, 4, 6],\n",
       " [1],\n",
       " [6, 11],\n",
       " [0, 1, 2, 5, 6, 13, 14],\n",
       " [14],\n",
       " [1],\n",
       " [0, 1, 2, 3, 5, 7, 8],\n",
       " [3],\n",
       " [0, 2],\n",
       " [1, 14],\n",
       " [9, 11],\n",
       " [0, 1, 2],\n",
       " [0, 3],\n",
       " [2, 11],\n",
       " [1, 9, 18],\n",
       " [1, 2],\n",
       " [1, 15],\n",
       " [1],\n",
       " [9],\n",
       " [1, 3],\n",
       " [3],\n",
       " [1, 11],\n",
       " [1, 7],\n",
       " [4, 7],\n",
       " [11],\n",
       " [0],\n",
       " [0, 8, 10, 18],\n",
       " [9],\n",
       " [0, 16],\n",
       " [2],\n",
       " [0, 1, 4, 11, 13],\n",
       " [3, 11],\n",
       " [7],\n",
       " [1, 7, 9],\n",
       " [1, 2],\n",
       " [1, 7],\n",
       " [0, 1, 3],\n",
       " [3],\n",
       " [0, 2, 9, 11],\n",
       " [0, 1, 4, 6, 8],\n",
       " [0, 1, 6, 10],\n",
       " [0, 1, 3, 4, 7, 8, 10, 16],\n",
       " [0, 1, 10, 13, 14],\n",
       " [8],\n",
       " [9],\n",
       " [1],\n",
       " [3, 4],\n",
       " [3],\n",
       " [1, 6],\n",
       " [0, 1, 7],\n",
       " [7],\n",
       " [9],\n",
       " [6],\n",
       " [3],\n",
       " [1, 4, 6, 9],\n",
       " [1, 2, 11],\n",
       " [3],\n",
       " [1, 3, 4],\n",
       " [1],\n",
       " [1, 2, 11],\n",
       " [1, 3, 7, 17],\n",
       " [2, 12],\n",
       " [1, 3],\n",
       " [6],\n",
       " [0, 1, 7, 9],\n",
       " [0, 1, 3, 4, 6, 11],\n",
       " [6],\n",
       " [6],\n",
       " [0, 1],\n",
       " [0],\n",
       " [1, 3],\n",
       " [1],\n",
       " [0],\n",
       " [2, 4, 8, 15],\n",
       " [1, 4],\n",
       " [0, 1, 2, 9],\n",
       " [0],\n",
       " [6, 13, 16],\n",
       " [10, 12],\n",
       " [1, 9],\n",
       " [2],\n",
       " [0, 1, 2, 3, 9],\n",
       " [0, 1, 2, 4, 8, 10],\n",
       " [1, 3, 9],\n",
       " [0, 1, 2, 5, 16],\n",
       " [1, 2, 16],\n",
       " [1, 9],\n",
       " [2, 3],\n",
       " [1, 9],\n",
       " [2, 6, 8, 16],\n",
       " [2],\n",
       " [2],\n",
       " [1, 16],\n",
       " [1, 5],\n",
       " [3],\n",
       " [2],\n",
       " [0, 4, 6, 9],\n",
       " [0, 1, 11],\n",
       " [3],\n",
       " [7],\n",
       " [1, 9],\n",
       " [3, 5],\n",
       " [16],\n",
       " [1],\n",
       " [7],\n",
       " [1, 3, 9],\n",
       " [3, 12],\n",
       " [1, 3, 5, 7, 10],\n",
       " [1, 2, 7],\n",
       " [0, 1, 7, 9, 13],\n",
       " [2, 4],\n",
       " [0, 2, 7],\n",
       " [3, 11, 14],\n",
       " [3, 4, 14],\n",
       " [0, 4],\n",
       " [0, 3, 10],\n",
       " [0, 11],\n",
       " [1, 3, 6, 10],\n",
       " [0, 13],\n",
       " [1, 10],\n",
       " [0, 1, 2],\n",
       " [0, 9, 11, 16],\n",
       " [1],\n",
       " [1, 3],\n",
       " [6],\n",
       " [1, 6, 11],\n",
       " [1, 7, 9],\n",
       " [2, 3],\n",
       " [1],\n",
       " [0, 1, 2, 10, 11, 15],\n",
       " [0, 1, 4, 9],\n",
       " [0, 11],\n",
       " [0, 3, 6],\n",
       " [0],\n",
       " [0, 1],\n",
       " [0, 1, 2],\n",
       " [3],\n",
       " [0, 1, 2, 4],\n",
       " [0],\n",
       " [0, 1, 12],\n",
       " [1],\n",
       " [15],\n",
       " [1, 13, 17],\n",
       " [0, 1, 2, 13],\n",
       " [1, 10],\n",
       " [1],\n",
       " [0],\n",
       " [1, 5],\n",
       " [1, 10],\n",
       " [7, 18],\n",
       " [0, 1, 2],\n",
       " [0, 3, 12],\n",
       " [1, 2, 11, 13],\n",
       " [1],\n",
       " [1, 2, 3, 14],\n",
       " [0, 1, 2],\n",
       " [1],\n",
       " [2],\n",
       " [2],\n",
       " [7],\n",
       " [1, 4],\n",
       " [1],\n",
       " [10],\n",
       " [1, 9],\n",
       " [0, 1, 7],\n",
       " [0, 2, 10],\n",
       " [0, 1, 6],\n",
       " [1, 3, 7],\n",
       " [0, 2, 3, 7],\n",
       " [0, 8, 12],\n",
       " [0, 1],\n",
       " [0, 1, 4],\n",
       " [6, 13],\n",
       " [1, 6],\n",
       " [1, 2, 3, 5],\n",
       " [0, 2, 10, 11],\n",
       " [0, 7, 10],\n",
       " [0, 5, 6, 7],\n",
       " [1, 4, 16],\n",
       " [0, 1, 2, 5, 11, 13],\n",
       " [1, 3, 8],\n",
       " [11],\n",
       " [0],\n",
       " [4],\n",
       " [2],\n",
       " [0, 1, 2, 10, 12],\n",
       " [0],\n",
       " [1, 6],\n",
       " [1, 6],\n",
       " [5],\n",
       " [1, 4, 7, 11, 13],\n",
       " [0, 3],\n",
       " [1],\n",
       " [2],\n",
       " [1, 10],\n",
       " [1],\n",
       " [1, 6],\n",
       " [1, 9, 11],\n",
       " [1, 5],\n",
       " [0, 1, 2],\n",
       " [1],\n",
       " [1],\n",
       " [0, 1, 7],\n",
       " [0, 1],\n",
       " [1, 10],\n",
       " [1, 5],\n",
       " [0],\n",
       " [1, 3, 9],\n",
       " [1, 4],\n",
       " [1, 4, 9, 18],\n",
       " [7, 10],\n",
       " [3, 7],\n",
       " [1, 2],\n",
       " [2],\n",
       " [6],\n",
       " [0, 1, 2, 3, 11],\n",
       " [2, 3, 10, 12],\n",
       " [2, 9],\n",
       " [0, 1, 5, 6, 8],\n",
       " [1, 5],\n",
       " [6],\n",
       " [1, 6],\n",
       " [1, 2, 9],\n",
       " [1, 3],\n",
       " [0],\n",
       " [6],\n",
       " [0, 4, 6, 13],\n",
       " [0, 1],\n",
       " [1, 2, 3, 4],\n",
       " [1, 2, 12],\n",
       " [0],\n",
       " [1, 2, 3],\n",
       " [1],\n",
       " [0, 1, 9, 11],\n",
       " [0, 2, 10, 11],\n",
       " [0, 7],\n",
       " [0],\n",
       " [0, 1],\n",
       " [1, 4, 13],\n",
       " [0],\n",
       " [13],\n",
       " [3, 13],\n",
       " [1],\n",
       " [0],\n",
       " [5],\n",
       " [6],\n",
       " [0, 1, 4, 9],\n",
       " [3, 6, 10],\n",
       " [3],\n",
       " [0],\n",
       " [3, 7],\n",
       " [6, 8],\n",
       " [1, 2],\n",
       " [1, 2],\n",
       " [0, 1],\n",
       " [0, 3, 6],\n",
       " [2],\n",
       " [2],\n",
       " [10, 12],\n",
       " [0, 12],\n",
       " [0, 2, 4, 11, 12],\n",
       " [4],\n",
       " [4],\n",
       " [0, 1, 2, 3, 4, 9],\n",
       " [2, 3, 11],\n",
       " [1, 16],\n",
       " [1, 2, 3, 4],\n",
       " [1],\n",
       " [1],\n",
       " [1, 3, 6, 7, 16],\n",
       " [4, 9, 11],\n",
       " [1, 6],\n",
       " [1, 4],\n",
       " [0, 2, 6],\n",
       " [0, 1, 2, 6, 7, 8],\n",
       " [0],\n",
       " [12, 13],\n",
       " [7, 9],\n",
       " [1, 3],\n",
       " [1, 8],\n",
       " [1, 2],\n",
       " [2],\n",
       " [2],\n",
       " [0, 2, 6, 9],\n",
       " [5, 6],\n",
       " [0, 1, 2],\n",
       " [2],\n",
       " [2],\n",
       " [1, 2, 9],\n",
       " [0, 1, 4, 9],\n",
       " [1],\n",
       " [1, 2, 3, 6],\n",
       " [0, 1],\n",
       " [1],\n",
       " [1],\n",
       " [0],\n",
       " [0, 1, 4, 8, 10],\n",
       " [1],\n",
       " [0, 1, 2, 3, 10, 13],\n",
       " [1, 3, 10, 13],\n",
       " [6],\n",
       " [0, 1, 2, 9, 10],\n",
       " [1],\n",
       " [0],\n",
       " [0, 1],\n",
       " [3, 11],\n",
       " [0, 1, 3, 8],\n",
       " [2, 6],\n",
       " [0, 1, 2, 3],\n",
       " [0, 3, 7, 9, 16],\n",
       " [1, 7],\n",
       " [0],\n",
       " [1],\n",
       " [12, 13, 15],\n",
       " [1, 12],\n",
       " [0],\n",
       " [0, 1, 12],\n",
       " [0, 2, 8, 11],\n",
       " [1, 3],\n",
       " [7],\n",
       " [0, 1, 5, 10],\n",
       " [1, 4],\n",
       " [3, 4, 7, 9],\n",
       " [0, 1, 10, 12],\n",
       " [1, 10],\n",
       " [7],\n",
       " [2],\n",
       " [0, 1, 6],\n",
       " [0, 1, 10],\n",
       " [0, 2, 11],\n",
       " [1, 5, 14],\n",
       " [1],\n",
       " [1, 11],\n",
       " [7],\n",
       " [7],\n",
       " [2, 7, 16],\n",
       " [1, 3, 5, 8],\n",
       " [0],\n",
       " [1],\n",
       " [1, 10],\n",
       " [0, 1, 2, 4, 5, 13],\n",
       " [2],\n",
       " [1],\n",
       " [0, 1, 2, 12],\n",
       " [0, 1, 4],\n",
       " [15],\n",
       " [1, 3, 7],\n",
       " [5, 6, 7, 13],\n",
       " [1, 3],\n",
       " [0, 1, 7],\n",
       " [1, 2, 4, 6, 7, 8, 13, 16],\n",
       " [3, 7],\n",
       " [0, 8],\n",
       " [0, 5, 8, 14],\n",
       " [0, 1],\n",
       " [1, 6],\n",
       " [0, 3],\n",
       " [1, 7, 16],\n",
       " [1],\n",
       " [6],\n",
       " [1, 2, 8, 12],\n",
       " [1],\n",
       " [1, 2],\n",
       " [1, 3],\n",
       " [10, 11],\n",
       " [1],\n",
       " [3, 17],\n",
       " [1, 2, 10],\n",
       " [0],\n",
       " [0, 1, 7],\n",
       " [1],\n",
       " [4, 7],\n",
       " [6],\n",
       " [1, 2, 7, 13],\n",
       " [4, 5],\n",
       " [0, 1, 4, 11],\n",
       " [1],\n",
       " [0, 1, 2, 13],\n",
       " [5],\n",
       " [1, 7, 8, 13, 16],\n",
       " [0],\n",
       " [0, 1, 9, 11],\n",
       " [0, 1, 3, 4],\n",
       " [1, 6, 10],\n",
       " [1, 4, 5],\n",
       " [2],\n",
       " [1],\n",
       " [6],\n",
       " [0, 1, 8, 10],\n",
       " [1, 4],\n",
       " [2, 18],\n",
       " [3, 5],\n",
       " [1, 7],\n",
       " [0, 7],\n",
       " [0, 1, 4],\n",
       " [1],\n",
       " [1],\n",
       " [0, 3],\n",
       " [0],\n",
       " [0, 1, 3, 4],\n",
       " [0, 10],\n",
       " [13],\n",
       " [4],\n",
       " [1, 3, 5, 8],\n",
       " [3],\n",
       " [1],\n",
       " [0, 1, 4, 11],\n",
       " [0, 3, 4, 9, 12],\n",
       " [1],\n",
       " [0, 1],\n",
       " [5],\n",
       " [1, 2, 7, 11],\n",
       " [0, 2],\n",
       " [0, 1, 8, 10, 12],\n",
       " [0, 7],\n",
       " [2, 9],\n",
       " [3],\n",
       " [2, 5, 10],\n",
       " [4],\n",
       " [0, 2, 3, 11],\n",
       " [0, 1, 3, 4, 6, 18],\n",
       " [4, 8],\n",
       " [0, 3],\n",
       " [11],\n",
       " [1, 3, 12],\n",
       " [0, 10],\n",
       " [1],\n",
       " [0, 1],\n",
       " [0, 1, 4, 5, 7, 8, 11, 14],\n",
       " [1, 2],\n",
       " [1, 3, 4, 6, 11, 13],\n",
       " [0, 3, 6, 11],\n",
       " [3],\n",
       " [0, 1],\n",
       " [1, 8],\n",
       " [0, 12],\n",
       " [1, 6, 8],\n",
       " [3, 4, 10],\n",
       " [0, 2, 11, 12],\n",
       " [1],\n",
       " [1, 3],\n",
       " [5],\n",
       " [0, 1, 4],\n",
       " [0, 2, 3, 4, 10, 11, 18],\n",
       " [7, 10],\n",
       " [2, 10],\n",
       " [1],\n",
       " [0, 5, 12],\n",
       " [1, 2, 3, 5, 14],\n",
       " [2],\n",
       " [7, 9, 15],\n",
       " [1, 10, 12],\n",
       " [0, 1, 4, 10, 13],\n",
       " [0, 1, 6, 7],\n",
       " [3, 9, 11, 15],\n",
       " [0, 1, 2, 4],\n",
       " [0, 1, 2, 4],\n",
       " [3, 11],\n",
       " [6],\n",
       " [0, 2, 11],\n",
       " [1, 2, 3],\n",
       " [3],\n",
       " [0, 11, 12],\n",
       " [0, 1, 2, 4, 11],\n",
       " [1, 5, 8],\n",
       " [1],\n",
       " [0, 2],\n",
       " [18],\n",
       " [4],\n",
       " [2],\n",
       " [0, 1],\n",
       " [0, 1, 2, 11, 12, 18],\n",
       " [0, 7, 15, 16],\n",
       " [10],\n",
       " [8],\n",
       " [2, 13],\n",
       " [7, 11],\n",
       " [7],\n",
       " [0, 1, 12],\n",
       " [1, 4, 7],\n",
       " [2, 11],\n",
       " [1, 3, 4, 5, 11],\n",
       " [0, 1, 13],\n",
       " [0, 1, 2, 12],\n",
       " [0],\n",
       " [0, 4, 8],\n",
       " [1, 9, 13],\n",
       " [0],\n",
       " [1, 10],\n",
       " [5],\n",
       " [0, 2],\n",
       " [0, 7, 8],\n",
       " [1, 2],\n",
       " [1, 3],\n",
       " [6],\n",
       " [7],\n",
       " [0, 2, 9, 11],\n",
       " [0, 1, 2, 4],\n",
       " [0, 1, 15],\n",
       " [1, 3, 4],\n",
       " [2],\n",
       " [1],\n",
       " [1, 2, 9, 11, 15],\n",
       " [13],\n",
       " [0, 1, 2, 4, 9],\n",
       " [0, 3, 12, 13],\n",
       " [0],\n",
       " [1, 3],\n",
       " [2],\n",
       " [1, 2, 10],\n",
       " [1, 2, 3],\n",
       " [0, 3, 5, 11],\n",
       " [0, 2],\n",
       " [1],\n",
       " [1, 11],\n",
       " [3, 5, 7],\n",
       " [0, 1, 2, 5, 10],\n",
       " [0, 1, 5],\n",
       " [0, 1],\n",
       " [0],\n",
       " [0, 1, 4, 5, 6, 8, 10, 11],\n",
       " [0, 10],\n",
       " [0],\n",
       " [0, 1, 2, 8, 15],\n",
       " [0, 4],\n",
       " [0, 6, 11],\n",
       " [0, 1, 4, 10],\n",
       " [0, 2, 4, 7],\n",
       " [1],\n",
       " [0],\n",
       " [1],\n",
       " [0, 2, 15],\n",
       " [4],\n",
       " [0, 2, 4, 7, 8],\n",
       " [1, 2, 4, 8],\n",
       " [1, 3],\n",
       " [0, 10, 11, 12],\n",
       " [1, 10],\n",
       " [0, 1],\n",
       " [0, 1],\n",
       " [0, 1, 4, 12],\n",
       " [0, 4, 10],\n",
       " [0],\n",
       " [0, 3, 9, 12],\n",
       " [1, 2],\n",
       " [0, 1, 4, 6],\n",
       " [0, 1, 5, 12],\n",
       " [1, 2, 3],\n",
       " [0, 5, 7, 18],\n",
       " [0, 3, 5, 10, 11],\n",
       " [0, 1],\n",
       " [4],\n",
       " [3, 5],\n",
       " [2, 4],\n",
       " [1, 6],\n",
       " [1, 13],\n",
       " [1],\n",
       " [0, 12],\n",
       " [1, 2],\n",
       " [1],\n",
       " [1, 2, 3],\n",
       " [1, 9],\n",
       " [4, 11, 13],\n",
       " [12],\n",
       " [1, 2],\n",
       " [0, 9],\n",
       " [1, 3, 13],\n",
       " [4],\n",
       " [0],\n",
       " [1, 3, 4],\n",
       " [0],\n",
       " [0, 1, 2, 14],\n",
       " [1, 2, 12],\n",
       " [0, 1, 4],\n",
       " [0, 1, 2, 3, 5, 7, 10, 13],\n",
       " [0],\n",
       " [0],\n",
       " [1, 10, 11, 15],\n",
       " [0, 1, 2, 3],\n",
       " [1, 7, 12],\n",
       " [0, 6],\n",
       " [5],\n",
       " [8, 19],\n",
       " [0, 1, 13],\n",
       " [1, 2, 5, 6],\n",
       " [4],\n",
       " [10],\n",
       " [0, 5, 9],\n",
       " [0],\n",
       " [0],\n",
       " [2],\n",
       " [1, 13],\n",
       " [0, 1, 2, 6],\n",
       " [1, 2],\n",
       " [0, 1, 3, 11, 12],\n",
       " [0, 5, 7],\n",
       " [3, 12],\n",
       " [0, 1, 5, 7, 8, 11],\n",
       " [1],\n",
       " [1, 3],\n",
       " [2],\n",
       " [3],\n",
       " [3, 11],\n",
       " [0],\n",
       " [1, 7],\n",
       " [0, 3, 4, 5, 10, 11, 12, 13],\n",
       " [10, 11],\n",
       " [0, 1],\n",
       " [0, 1, 2, 10],\n",
       " [1],\n",
       " [1, 6],\n",
       " [0, 10],\n",
       " [2],\n",
       " [1, 3],\n",
       " [0, 12],\n",
       " [0, 1],\n",
       " [10],\n",
       " [0, 1, 9],\n",
       " [3, 13],\n",
       " [2, 6],\n",
       " [0, 1, 5, 7, 9, 11, 12],\n",
       " [3, 6],\n",
       " [0, 3],\n",
       " [3],\n",
       " [0, 1, 2, 7],\n",
       " [1, 6, 9, 10, 11],\n",
       " [4],\n",
       " [1],\n",
       " [1],\n",
       " [1],\n",
       " [5, 6],\n",
       " [4],\n",
       " [1],\n",
       " [18],\n",
       " [0, 1],\n",
       " [6, 8, 12],\n",
       " [3],\n",
       " [0, 2, 5, 6, 10],\n",
       " [0, 1, 4, 15],\n",
       " [1],\n",
       " [0, 1, 8, 10, 12],\n",
       " [0, 1, 2, 7],\n",
       " [0, 2, 6],\n",
       " [1, 3, 4, 9],\n",
       " [2, 6, 9, 10, 11, 15],\n",
       " [9],\n",
       " [5, 7, 11],\n",
       " [0, 1, 3, 7],\n",
       " [0, 4],\n",
       " [5, 18],\n",
       " [10],\n",
       " [2],\n",
       " [0, 1, 2, 15],\n",
       " [1, 8, 9, 11],\n",
       " [2],\n",
       " [1, 7, 10, 12],\n",
       " [2],\n",
       " [1, 2],\n",
       " [1],\n",
       " [10],\n",
       " [1, 10],\n",
       " [0],\n",
       " [0, 1, 8, 19],\n",
       " [1],\n",
       " [1, 3, 5],\n",
       " [7, 11],\n",
       " [7],\n",
       " [0, 8, 12],\n",
       " [1, 12],\n",
       " [1, 4],\n",
       " [2, 4],\n",
       " [2, 4, 5, 10],\n",
       " [0, 1, 2, 4, 11],\n",
       " [8, 12],\n",
       " [1, 14],\n",
       " [0, 1, 2, 3],\n",
       " [1],\n",
       " [0, 10],\n",
       " [1],\n",
       " [0, 1, 10],\n",
       " [0, 1, 3, 7, 11, 12],\n",
       " [0, 1, 4, 9],\n",
       " [7, 12],\n",
       " [2],\n",
       " [1, 18],\n",
       " [2, 7, 10],\n",
       " [1],\n",
       " [1, 3, 7, 11],\n",
       " [1],\n",
       " [0, 4, 11],\n",
       " [0, 1, 13],\n",
       " [1, 7],\n",
       " [0, 1, 2, 4, 10, 18],\n",
       " [0, 2, 4, 11, 13],\n",
       " [0, 1, 2, 4, 13, 14],\n",
       " [0, 1, 10],\n",
       " [0],\n",
       " [0],\n",
       " [1],\n",
       " [0, 1, 2, 9],\n",
       " [0],\n",
       " [3, 6],\n",
       " [0, 2, 15],\n",
       " [1],\n",
       " [0],\n",
       " [0],\n",
       " [4, 7],\n",
       " [0, 1],\n",
       " [9, 11],\n",
       " [1, 2, 4, 5, 7],\n",
       " [0, 1],\n",
       " [1],\n",
       " [2],\n",
       " [1],\n",
       " [10, 16],\n",
       " [0, 12],\n",
       " [15],\n",
       " [16],\n",
       " [0],\n",
       " [0, 1, 2, 3, 5, 6, 10],\n",
       " [1, 6, 11],\n",
       " [12],\n",
       " [0, 1, 2, 13, 14],\n",
       " [1],\n",
       " [0, 1],\n",
       " [1, 8],\n",
       " [1, 14],\n",
       " [1],\n",
       " [1],\n",
       " [0, 3, 7, 12],\n",
       " [5, 18],\n",
       " [0, 1, 2, 5, 7, 10],\n",
       " [1, 2, 13],\n",
       " [1, 2, 9, 10],\n",
       " [0, 7, 8],\n",
       " [0, 1, 5],\n",
       " [1, 2, 5],\n",
       " [2],\n",
       " [0, 1, 12],\n",
       " [4, 7],\n",
       " [0, 2, 3],\n",
       " [0, 1, 6, 7],\n",
       " [1, 4, 8],\n",
       " [5],\n",
       " [7],\n",
       " [2, 12],\n",
       " [1, 3, 4, 6, 10],\n",
       " [0, 2, 10, 15],\n",
       " [0, 1, 2],\n",
       " [0, 4, 7, 10],\n",
       " [0, 9],\n",
       " [0, 1, 5, 12],\n",
       " [6, 12],\n",
       " [1],\n",
       " [4],\n",
       " [1],\n",
       " [1, 4, 5, 11],\n",
       " [4, 10, 11],\n",
       " [4, 14],\n",
       " [0, 7],\n",
       " [1, 2, 3, 5],\n",
       " [1],\n",
       " [0, 1, 2, 3],\n",
       " [0, 1, 3],\n",
       " [1],\n",
       " [0, 1],\n",
       " [1, 7, 15],\n",
       " [1, 7, 8],\n",
       " [3],\n",
       " [1, 2, 11],\n",
       " [3],\n",
       " [0, 1, 3, 7, 16],\n",
       " [0, 3, 6],\n",
       " [0],\n",
       " [0, 2, 3, 6, 13],\n",
       " [0],\n",
       " [1],\n",
       " [0],\n",
       " [11],\n",
       " [2, 10],\n",
       " [10, 14],\n",
       " [4],\n",
       " [0, 1, 5, 6, 9, 11, 15],\n",
       " [1],\n",
       " [1],\n",
       " [1, 7, 13],\n",
       " [1],\n",
       " [1],\n",
       " [0],\n",
       " [11],\n",
       " [1],\n",
       " [1, 3, 14],\n",
       " [0, 1, 5],\n",
       " [2, 3, 4, 6, 11, 12],\n",
       " [1, 2],\n",
       " [1, 14, 17],\n",
       " [1, 2, 3, 5, 12, 13],\n",
       " [0, 1, 2],\n",
       " [2, 3],\n",
       " [1, 3],\n",
       " [9, 12],\n",
       " [1],\n",
       " [1, 2, 8],\n",
       " [0, 1],\n",
       " [3, 5, 8, 11, 14, 19],\n",
       " [0, 1, 4, 6, 18],\n",
       " [15],\n",
       " [1, 3],\n",
       " [0, 1, 10, 13],\n",
       " [0, 1, 2, 3, 10, 14],\n",
       " [0, 2, 11],\n",
       " [3, 7],\n",
       " [4, 12],\n",
       " [0, 3, 7],\n",
       " [1, 2, 3],\n",
       " [3],\n",
       " [2, 7, 9, 19],\n",
       " [0, 1, 7],\n",
       " [2, 6],\n",
       " [0, 1, 2, 6, 15],\n",
       " [2],\n",
       " [1, 4],\n",
       " [2],\n",
       " [0, 2],\n",
       " [4, 5],\n",
       " [3, 10],\n",
       " [0, 1, 2, 4, 8],\n",
       " [1],\n",
       " [14],\n",
       " [0, 1, 8],\n",
       " [2],\n",
       " [0, 2],\n",
       " [4],\n",
       " [0],\n",
       " [2],\n",
       " [0, 1],\n",
       " [8, 11],\n",
       " [1, 2],\n",
       " [0, 3],\n",
       " [1, 2, 3],\n",
       " [2, 13],\n",
       " [0, 5],\n",
       " [14],\n",
       " [1, 6],\n",
       " [6],\n",
       " [1, 2],\n",
       " [0, 1],\n",
       " [1, 2],\n",
       " [0, 3],\n",
       " [0, 3, 8, 12],\n",
       " [0],\n",
       " [8],\n",
       " [1],\n",
       " [0, 5, 6],\n",
       " [0, 2],\n",
       " [18],\n",
       " [11],\n",
       " [1, 10],\n",
       " [6, 13, 18],\n",
       " [0, 1, 6],\n",
       " [7],\n",
       " [1, 11],\n",
       " [1, 8, 12, 13],\n",
       " [1, 3, 4, 6],\n",
       " [0, 1, 3, 6, 11],\n",
       " [1, 2, 8, 14, 15],\n",
       " [5, 6, 13],\n",
       " [1, 3, 4],\n",
       " [13],\n",
       " [1, 2, 3],\n",
       " [6, 7],\n",
       " [1, 12],\n",
       " [12],\n",
       " [1, 2, 4],\n",
       " [1, 4],\n",
       " [1, 3],\n",
       " [0, 1, 2, 4],\n",
       " [1, 10],\n",
       " [1, 2, 4],\n",
       " [6],\n",
       " [5],\n",
       " [1, 14],\n",
       " [12],\n",
       " [1],\n",
       " [2],\n",
       " [1, 4],\n",
       " [0],\n",
       " [2, 4],\n",
       " [1],\n",
       " [0, 1],\n",
       " [4],\n",
       " [0, 1, 2, 4, 7],\n",
       " [9, 13],\n",
       " [1, 3, 4],\n",
       " [8],\n",
       " [2],\n",
       " [0, 1, 3],\n",
       " [0, 1, 3],\n",
       " [0, 3, 16],\n",
       " [12],\n",
       " [1, 2, 8, 18],\n",
       " [0, 1],\n",
       " [0, 1, 2, 16],\n",
       " [7],\n",
       " [0, 1, 10],\n",
       " [0, 1, 2, 5, 6, 9, 13],\n",
       " [10],\n",
       " [1, 4, 8],\n",
       " [0, 4, 6],\n",
       " [0, 1, 3, 4, 6, 7, 10],\n",
       " [7],\n",
       " [1, 2],\n",
       " [1, 4],\n",
       " [2],\n",
       " [1, 4, 6, 16],\n",
       " [1],\n",
       " [0, 3, 8, 12, 15],\n",
       " [3],\n",
       " [1, 2, 7],\n",
       " [18],\n",
       " [0, 1, 3, 15],\n",
       " [0, 1, 2, 13, 15],\n",
       " [18],\n",
       " [1, 6, 9],\n",
       " [2, 4, 6],\n",
       " [10],\n",
       " [1],\n",
       " [0, 2],\n",
       " [0, 7],\n",
       " [1, 8],\n",
       " [4, 11],\n",
       " [0, 6],\n",
       " [0, 6],\n",
       " [3],\n",
       " [5],\n",
       " [1],\n",
       " [1, 3],\n",
       " [0, 6, 15],\n",
       " ...]"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import orangecontrib.associate.fpgrowth as oaf  #进行关联规则分析的包\n",
    "Y=[[i for i in range(item.shape[0]) if item[i]==1] for item in data]\n",
    "Y"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{frozenset({0}): 16201, frozenset({1}): 21333, frozenset({0, 1}): 7429, frozenset({2}): 12879, frozenset({1, 2}): 6015, frozenset({3}): 9468, frozenset({1, 3}): 4879, frozenset({4}): 6949, frozenset({5}): 7084, frozenset({6}): 7045, frozenset({7}): 5267, frozenset({8}): 4803, frozenset({9}): 5050, frozenset({10}): 5363, frozenset({11}): 4951}\n",
      "[(frozenset({1}), frozenset({0}), 7429, 0.34823981624712885), (frozenset({0}), frozenset({1}), 7429, 0.45855194123819515), (frozenset({2}), frozenset({1}), 6015, 0.4670393664104356), (frozenset({1}), frozenset({2}), 6015, 0.28195753058641543), (frozenset({3}), frozenset({1}), 4879, 0.5153147444021968), (frozenset({1}), frozenset({3}), 4879, 0.22870669854216472)]\n"
     ]
    }
   ],
   "source": [
    "itemsets = dict(oaf.frequent_itemsets(data , .1)) #这里设置支持度\n",
    "rules = oaf.association_rules(itemsets, .1)   #这里设置置信度\n",
    "rules = list(rules)\n",
    "print(itemsets)\n",
    "print(rules)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "0ea2ea13f89004d253f237dbfddddbdca6ade9e7c69d0cba8f71d034288dfba7"
  },
  "kernelspec": {
   "display_name": "Python 3.8.8 64-bit ('tensorflow': conda)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
